package 贪心;

import java.util.Arrays;

public class q455分发饼干 {
    class Solution {
        public int findContentChildren(int[] g, int[] s) {
            // 采用小饼干喂饱小胃口
            Arrays.sort(g);
            Arrays.sort(s);
            int count = 0;
            int gIndex = 0;
            for(int i = 0 ; i < s.length && gIndex < g.length; i++){
                if(s[i] >= g[gIndex]){
                    count++;
                    gIndex++;
                }

            }
            return count;
        }
    }
}
